dcmotor32 2.2.0
Loading...
Searching...
No Matches
DC Motor 32 Click Driver

API for configuring and manipulating DC Motor 32 Click driver. More...

Topics

 DC Motor 32 Settings
 Settings of DC Motor 32 Click driver.
 DC Motor 32 MikroBUS Map
 MikroBUS pin mapping of DC Motor 32 Click driver.

Functions

void dcmotor32_cfg_setup (dcmotor32_cfg_t *cfg)
 DC Motor 32 configuration object setup function.
err_t dcmotor32_init (dcmotor32_t *ctx, dcmotor32_cfg_t *cfg)
 DC Motor 32 initialization function.
err_t dcmotor32_default_cfg (dcmotor32_t *ctx)
 DC Motor 32 default configuration function.
err_t dcmotor32_set_control (dcmotor32_t *ctx, uint8_t control)
 DC Motor 32 set control function.
err_t dcmotor32_get_status (dcmotor32_t *ctx)
 DC Motor 32 get status function.
err_t dcmotor32_set_operation_mode (dcmotor32_t *ctx, uint8_t mode)
 DC Motor 32 set operation mode function.
err_t dcmotor32_enable_isense (dcmotor32_t *ctx)
 DC Motor 32 enable current sense function.
err_t dcmotor32_disable_isense (dcmotor32_t *ctx)
 DC Motor 32 disable current sense function.
err_t dcmotor32_set_fast_slew_rate (dcmotor32_t *ctx)
 DC Motor 32 set fast slew rate function.
err_t dcmotor32_set_slow_slew_rate (dcmotor32_t *ctx)
 DC Motor 32 set slow slew rate function.
err_t dcmotor32_enable_device (dcmotor32_t *ctx)
 DC Motor 32 enable device function.
err_t dcmotor32_disable_device (dcmotor32_t *ctx)
 DC Motor 32 disable device function.
err_t dcmotor32_read_adc_raw (dcmotor32_t *ctx, uint16_t *data_out)
 DC Motor 32 read raw IS ADC value function.
err_t dcmotor32_read_adc_volt (dcmotor32_t *ctx, float *data_out)
 DC Motor 32 read IS pin voltage level function.
err_t dcmotor32_read_adc_volt_avg (dcmotor32_t *ctx, uint16_t num_conv, float *volt_avg)
 DC Motor 32 read IS pin voltage level average function.
err_t dcmotor32_set_adc_vref (dcmotor32_t *ctx, float vref)
 DC Motor 32 set vref function.
err_t dcmotor32_calib_offset (dcmotor32_t *ctx)
 DC Motor 32 calibrate offset function.
err_t dcmotor32_get_out_current (dcmotor32_t *ctx, float *current)
 DC Motor 32 get output current function.

Detailed Description

API for configuring and manipulating DC Motor 32 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ dcmotor32_calib_offset()

err_t dcmotor32_calib_offset ( dcmotor32_t * ctx)

DC Motor 32 calibrate offset function.

This function measures and stores the zero current offset voltage.

Parameters
[in]ctx: Click context object. See dcmotor32_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dcmotor32_cfg_setup()

void dcmotor32_cfg_setup ( dcmotor32_cfg_t * cfg)

DC Motor 32 configuration object setup function.

This function initializes Click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See dcmotor32_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ dcmotor32_default_cfg()

err_t dcmotor32_default_cfg ( dcmotor32_t * ctx)

DC Motor 32 default configuration function.

This function executes a default configuration of DC Motor 32 Click board.

Parameters
[in]ctx: Click context object. See dcmotor32_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ dcmotor32_disable_device()

err_t dcmotor32_disable_device ( dcmotor32_t * ctx)

DC Motor 32 disable device function.

This function disables the device.

Parameters
[in]ctx: Click context object. See dcmotor32_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dcmotor32_disable_isense()

err_t dcmotor32_disable_isense ( dcmotor32_t * ctx)

DC Motor 32 disable current sense function.

This function disables the current sense function.

Parameters
[in]ctx: Click context object. See dcmotor32_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dcmotor32_enable_device()

err_t dcmotor32_enable_device ( dcmotor32_t * ctx)

DC Motor 32 enable device function.

This function enables the device.

Parameters
[in]ctx: Click context object. See dcmotor32_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dcmotor32_enable_isense()

err_t dcmotor32_enable_isense ( dcmotor32_t * ctx)

DC Motor 32 enable current sense function.

This function enables the current sense function.

Parameters
[in]ctx: Click context object. See dcmotor32_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dcmotor32_get_out_current()

err_t dcmotor32_get_out_current ( dcmotor32_t * ctx,
float * current )

DC Motor 32 get output current function.

This function calculates the output current from the measured ADC voltage.

Parameters
[in]ctx: Click context object. See dcmotor32_t object definition for detailed explanation.
[out]current: Pointer to the memory location where the output current will be stored.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The current is calculated using the stored zero current offset value.

◆ dcmotor32_get_status()

err_t dcmotor32_get_status ( dcmotor32_t * ctx)

DC Motor 32 get status function.

This function reads the device status byte using SPI communication.

Parameters
[in]ctx: Click context object. See dcmotor32_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The SDO select field is set to status mode before reading.

◆ dcmotor32_init()

err_t dcmotor32_init ( dcmotor32_t * ctx,
dcmotor32_cfg_t * cfg )

DC Motor 32 initialization function.

This function initializes all necessary pins and peripherals used for this Click board.

Parameters
[out]ctx: Click context object. See dcmotor32_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See dcmotor32_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dcmotor32_read_adc_raw()

err_t dcmotor32_read_adc_raw ( dcmotor32_t * ctx,
uint16_t * data_out )

DC Motor 32 read raw IS ADC value function.

This function reads results of AD conversion of the IS pin.

Parameters
[in]ctx: Click context object. See dcmotor32_t object definition for detailed explanation.
[out]data_out: Output ADC result.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dcmotor32_read_adc_volt()

err_t dcmotor32_read_adc_volt ( dcmotor32_t * ctx,
float * data_out )

DC Motor 32 read IS pin voltage level function.

This function reads results of AD conversion of the IS pin and converts them to proportional voltage level.

Parameters
[in]ctx: Click context object. See dcmotor32_t object definition for detailed explanation.
[out]data_out: Output voltage level of the analog pin [V].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The conversion to voltage depends on the entered configuration of the ADC (resolution, reference voltage).

◆ dcmotor32_read_adc_volt_avg()

err_t dcmotor32_read_adc_volt_avg ( dcmotor32_t * ctx,
uint16_t num_conv,
float * volt_avg )

DC Motor 32 read IS pin voltage level average function.

This function a desired number of IS pin ADC voltage samples and averages it.

Parameters
[in]ctx: Click context object. See dcmotor32_t object definition for detailed explanation.
[in]num_conv: Number of ADC samples.
[out]volt_avg: Average output voltage level [V].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The conversion to voltage depends on the entered configuration of the ADC (resolution, reference voltage).

◆ dcmotor32_set_adc_vref()

err_t dcmotor32_set_adc_vref ( dcmotor32_t * ctx,
float vref )

DC Motor 32 set vref function.

This function sets the ADC voltage reference for DC Motor 32 Click driver.

Parameters
[in]ctx: Click context object. See dcmotor32_t object definition for detailed explanation.
[in]vref: Reference voltage (volts).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The default voltage reference set with dcmotor32_init is 3.3V.

◆ dcmotor32_set_control()

err_t dcmotor32_set_control ( dcmotor32_t * ctx,
uint8_t control )

DC Motor 32 set control function.

This function writes the control value and checks the returned control byte.

Parameters
[in]ctx: Click context object. See dcmotor32_t object definition for detailed explanation.
[in]control: Control register value.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The SDO select field is set to control mode before writing.

◆ dcmotor32_set_fast_slew_rate()

err_t dcmotor32_set_fast_slew_rate ( dcmotor32_t * ctx)

DC Motor 32 set fast slew rate function.

This function sets the output slew rate to fast mode.

Parameters
[in]ctx: Click context object. See dcmotor32_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dcmotor32_set_operation_mode()

err_t dcmotor32_set_operation_mode ( dcmotor32_t * ctx,
uint8_t mode )

DC Motor 32 set operation mode function.

This function sets the selected device operation mode.

Parameters
[in]ctx: Click context object. See dcmotor32_t object definition for detailed explanation.
[in]mode: Operation mode value.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ dcmotor32_set_slow_slew_rate()

err_t dcmotor32_set_slow_slew_rate ( dcmotor32_t * ctx)

DC Motor 32 set slow slew rate function.

This function sets the output slew rate to slow mode.

Parameters
[in]ctx: Click context object. See dcmotor32_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.